package com.pr.makfilm.user.pages.school.list;

import com.pr.makfilm.core.cmp.authorization.UserAuthorities;
import com.pr.makfilm.core.cmp.tabbedPanel.BootstrapTabbedPanel;
import com.pr.makfilm.user.api.UserApiMappings;
import com.pr.makfilm.user.pages.AbstractUserPage;
import com.pr.makfilm.user.pages.school.list.cmp.DistrictTab;
import com.pr.makfilm.user.pages.school.list.cmp.SchoolTab;
import com.pr.makfilm.user.pages.school.list.cmp.SchoolTypeTab;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.ResourceModel;
import org.wicketstuff.annotation.mount.MountPath;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Pawel
 * Date: 11.09.13
 * Time: 00:07
 * To change this template use File | Settings | File Templates.
 */
@MountPath(UserApiMappings.SCHOOL_LIST_PAGE)
@AuthorizeInstantiation(UserAuthorities.USER)
public class SchoolListPage extends AbstractUserPage
{
   @Override
   protected void onInitialize()
   {
      super.onInitialize();
      List<ITab> tabs = new ArrayList<ITab>();
      tabs.add(new AbstractTab(new ResourceModel("school.tab"))
      {
         @Override
         public WebMarkupContainer getPanel(String panelId)
         {
            return new SchoolTab(panelId);
         }
      });
      tabs.add(new AbstractTab(new ResourceModel("school.type.tab"))
      {
         @Override
         public WebMarkupContainer getPanel(String panelId)
         {
            return new SchoolTypeTab(panelId);
         }
      });
      tabs.add(new AbstractTab(new ResourceModel("district.tab"))
      {
         @Override
         public WebMarkupContainer getPanel(String panelId)
         {
            return new DistrictTab(panelId);
         }
      });
      add(new BootstrapTabbedPanel("tabs", tabs));
   }
}
